<html>
<head>
<title>RChart, User Guide</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" leftmargin="35">
<h3>RCHART, User Guide</h3>
<p><font face="Arial, Helvetica, sans-serif" size="-1"><i>Copyright 2005, J4L 
  Components (http://www.java4less.com)</i></font> <br>
  <a href="tutorialcontents.html">Go bak to contents</a></p>
<hr>
<h3><font face="Arial, Helvetica, sans-serif">RChart , first steps.</font></h3>
<ul>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><a href="#3">Installation</a></font></li>
  <li><a href="#req"><font face="Arial, Helvetica, sans-serif" size="-1">Requirements</font></a></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><a href="#0">Where to 
    start</a></font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><a href="#1">Format 
    of the parameters</a><a href="#2"> </a></font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><a href="#gc"> Graphic 
    Context Provider</a> (AWT and SWT)</font></li>
</ul>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="3"></a>Installation</font></h4>
<font face="Arial, Helvetica, sans-serif" size="-1">The installation of RChart 
is very simple:</font> 
<ol>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"> Either you download 
    the evaluation version from <a href="http://www.java4less.com">http://www.java4less.com 
    </a> or you have received the registered product per email.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">Unzip the file you have 
    downloaded in an empty directory. Make sure you unzip also the subdirectories.</font></li>
</ol>
<font face="Arial, Helvetica, sans-serif" size="-1">You can now open the following 
files:</font> 
<ul>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">UserGuide/tutorialcontents.html: 
    opens this user guide.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">bin/VisualBuilder.bat: 
    starts Rchart visual builder.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">examples_swt/run.bat: 
    starts the SWT sample application (you must first edit it and change the SWT_JAR 
    and SWT_LIB variables so that they point to your SWT installation).</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">examples_swing/run.bat: 
    starts the Swing sample application. Swing is included in JDK 1.3 and later. 
    If you use JDK 1.1 or JDK 1.2 you must copy swingAll.jar to the directory 
    before running the file.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">examples_awt/run.bat: 
    starts the Awt sample application.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">examples_jsp: contains 
    the <a href="chartServlet.html">JSP</a> sample application</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">examples_servlet: contains 
    instructions for the use of the <a href="chartServlet.html">servlet</a></font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">examples_applet/examples.html: 
    applet examples<br>
    </font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">JavaDoc/index.htm: open 
    the javadoc help files.</font></li>
</ul>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="req"></a>Requirements</font></h4>
<p><font face="Arial, Helvetica, sans-serif" size="-1">RChart will work with:</font></p>
<ul>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"> JDK 1.1 (some features 
    like transparencies are not available)</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"> JDK 1.2 or later</font> 
  </li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">If you use SWT, it has 
    been tested with SWT 2.1 and 3.</font></li>
</ul>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="0"></a>Where 
  to start</font></h4>
<p><font face="Arial, Helvetica, sans-serif" size="-1">As starting point we recommend 
  you not to create a chart from scratch but to take one of the examples we provide 
  and start working by modifying it.</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="-1"> But first of all you must 
  be aware that there are 2 ways to create a chart:</font> </p>
<ol>
  <li><font size="-1" face="Arial, Helvetica, sans-serif">either you create it 
    <b>using the Java API,</b> creating the RChart java objects and setting the 
    properties (see File bin/ChartExamples.java)</font></li>
  <li><font size="-1" face="Arial, Helvetica, sans-serif">or you create the chart 
    by <b>means of the ChartLoader</b>. In this case you do not have to worry 
    about the Java API. You just have to create a list of parameters and use the 
    ChartLoader class to create the chart (see examples in directory data/examples).</font></li>
</ol>
<font face="Arial, Helvetica, sans-serif" size="-1">We recommend you to use the 
second approach (using the ChartLoader) for the following reasons:</font> 
<ul>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">You can create the parameters 
    for the ChartLoader using <a href="RChartVB_Help.html">RChart Visual Builder</a>.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">It is easier to learn.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">It is easier to develop 
    and debug.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">You can reuse the java 
    code since the same code can load different charts.</font></li>
</ul>
<p><font face="Arial, Helvetica, sans-serif" size="-1">Nevertheless this guide 
  provides both the parameter names and the equivalent Java class and property.</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="-1">If you want to use the 
  RChart in a:</font></p>
<ul>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">Swing application, <a href="chartAPI.html">see 
    the ChartViewers here</a>.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">SWT application, <a href="chartAPI.html">see 
    the ChartViewers here</a>.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">JSP /Servlet application, 
    <a href="chartServlet.html">see the JSP information here.</a></font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">As Applet , <a href="chartApplet.html">see 
    the applet documentation here</a>.</font></li>
</ul>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="1"></a>Format 
  of the parameters</font></h4>
<p><font face="Arial, Helvetica, sans-serif" size="-1">If you are going to create 
  you chart by mean of the chart loader (instead of using the Java API), there 
  are some parameters that have a special format:</font></p>
<ul>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><b>Colors</b>: predefined 
    values are: <br>
    <br>
    </font> 
    <table width="92%" border="0" height="315">
      <tr valign="top"> 
        <td width="26%" height="316"><font face="Courier New, Courier, mono" size="-1">RED<br>
          WHITE<br>
          GREEN <br>
          BLUE<br>
          YELLOW<br>
          GRAY<br>
          DARKGRAY<br>
          BLACK<br>
          LIME <br>
          OLIVE<br>
          MAROON<br>
          NAVY <br>
          PURPLE <br>
          TELA <br>
          FUCHSIA <br>
          AQUA <br>
          ALICEBLUE <br>
          ANTIQUEWHITE <br>
          AQUAMARINE <br>
          <br>
          </font></td>
        <td width="27%" height="316"><font face="Courier New, Courier, mono" size="-1"> 
          AZURE <br>
          BEIGE <br>
          BLUEVIOLET <br>
          BROWN <br>
          BORLYWOOD <br>
          CORAL <br>
          CYAN <br>
          DARKGOLDENROD <br>
          DARKGREEN <br>
          DARKOLIVEGREEN <br>
          DARKORANGE <br>
          DARKORCHID <br>
          DARKSALMON <br>
          DARKTURQUOISE <br>
          DARKVIOLET<br>
          DEEPPINK <br>
          DEEPSKYBLUE <br>
          FORESTGREEN <br>
          GOLD </font></td>
        <td width="25%" height="316"><font face="Courier New, Courier, mono" size="-1"> 
          GOLDENROD <br>
          GREENYELLOW <br>
          HOTPINK <br>
          INDIANRED <br>
          IVORY <br>
          LAVENDER <br>
          LAWNGREEN <br>
          LIGHTBLUE <br>
          LIGHTCORAL <br>
          LIGHTCYAN <br>
          LIGHTGRAY <br>
          LIGHTPINK <br>
          LIGHTSALMON <br>
          LIGHTSKYBLUE <br>
          LIGHTYELLO <br>
          LIMEGREEN <br>
          MAGENTA <br>
          MEDIUMBLUE <br>
          MEDIUMPURPLE <br>
          <br>
          </font></td>
        <td width="22%" height="316"><font face="Courier New, Courier, mono" size="-1"> 
          MIDNIGHTBLUE<br>
          ORANGE <br>
          ORANGERED <br>
          ORCHID <br>
          PALEGREEN <br>
          PALETURQUOISE<br>
          PALEVIOLETRED <br>
          PINK <br>
          PLUM <br>
          PURPLE <br>
          SALMON<br>
          SEAGREEN <br>
          SIENNA <br>
          SKYBLUE <br>
          SPRINGGREEN <br>
          TURQUOISE<br>
          VIOLET<br>
          YELLOWGREEN </font></td>
      </tr>
    </table>
    <font face="Arial, Helvetica, sans-serif" size="-1"><br>
    <br>
    </font><font face="Arial, Helvetica, sans-serif" size="-1">You can also use 
    the RGB numeric value of a color as parameter. For example &quot;0xFF0000&quot; 
    is red (RGB format), &quot;00x00FF00&quot; is green and so on. <br>
    <br>
    <br>
    </font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><b>List of values</b>. 
    List of values a separated by &quot;|&quot;, only certain parameters like 
    FiIll styles uses another separator.</font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><b>Fonts</b> have the 
    format &lt;font name&gt;|&lt;style&gt;|&lt;size&gt;. Style can be PLAIN, ITALIC 
    or BOLD. Example: &quot;Arial|BOLD|12&quot; </font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><b>Line styles</b> have 
    the format &lt;width&gt;|&lt;color&gt;|&lt;style&gt;. Style can be LINE, DASHED 
    or DOTS. Example: &quot;1|RED|LINE&quot;.<br>
    You can define transparency in line styles using an additional parameter: 
    &lt;width&gt;|&lt;color&gt;|&lt;style&gt;|&lt;transparency&gt;. &lt;transparency&gt; 
    is a value between 0 (full transparent) and 1 (opaque). We recommend 0.5. 
    <br>
    </font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1"><b>Fill style</b>: there 
    are several options: </font> 
    <ul>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">&lt;color&gt;: for 
        plain color filling.</font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">&lt;color&gt;|&lt;transparentcy&gt;: 
        for transparent color filling. &lt;transparency&gt; is a value between 
        0 (full transparent) and 1 (opaque). We recommend 0.5.<br>
        <br>
        Note: transparency will only work for jdk 1.2 or later (previous versions 
        will ignore it).<br>
        <br>
        </font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">&lt;colorFrom&gt;:&lt;colorTo&gt;:&lt;orientation&gt;: 
        for gadient filling. &lt;orientation&gt; can be VERTICAL or HORIZONTAL. 
        The fill style of following bar has been defined with &quot;RED:ORANGE:HORIZONTAL&quot;. 
        <br>
        <br>
        <img src="images/gradient.PNG" width="221" height="26"><br>
        <br>
        as you can see the color changes from the &lt;colorFrom&gt; to the &lt;colorTo&gt;. 
        <br>
        <br>
        </font></li>
      <li><font face="Arial, Helvetica, sans-serif" size="-1">&lt;imageFile&gt;. 
        For patten filling. The following area chart uses a pattern filling defined 
        as &quot;pattern1.gif&quot;<br>
        <br>
        <img src="images/pattern.PNG" width="325" height="149"> <br>
        <br>
        where the patter file &quot;pattern1.gif</font><font face="Arial, Helvetica, sans-serif" size="-1">&quot; 
        is:<br>
        </font><font face="Arial, Helvetica, sans-serif" size="-1"><br>
        <img src="images/pattern1.gif" width="15" height="15"><br>
        <br>
        Note: pattern filling is not supported by the SWT and Java 1.1 implementations.</font><font face="Arial, Helvetica, sans-serif" size="-1"><br>
        <br>
        </font></li>
    </ul>
  </li>
</ul>
<p>&nbsp;</p>
<h4><font face="Arial, Helvetica, sans-serif" size="-1"><a name="gc"></a>RChart 
  Graphic Context Provider</font></h4>
<p><font face="Arial, Helvetica, sans-serif" size="-1">As you know rchart can 
  work in AWT/Swing mode or in SWT mode. For this reason, all graphic functions 
  which are specific to SWT or AWT are implemented in a package (com.java4less.rchart.gc) 
  which is an abstract layer above the specific graphic implementation (see diagram).</font></p>
<p align="center"><img src="images/chartArch.PNG" width="254" height="279"></p>
<p>&nbsp;</p>
<p><font face="Arial, Helvetica, sans-serif" size="-1">The default implemementation 
  is AWT, however you can switch to SWT by means of the following code:</font></p>
<blockquote>
  <p><font face="Courier New, Courier, mono" size="-1">GraphicsProvider.setMode(GraphicsProvider.MODE_SWT);</font></p>
</blockquote>
<p><font face="Arial, Helvetica, sans-serif" size="-1">There is a third implementation 
  called AWT1 which is compatible with JDK1.1. If you select AWT and your current 
  Java version is 1.1, RChart will automatically select AWT1. In other other, 
  RChart will work with JDK 1.1 or later.</font></p>
<p><font size="-1" face="Arial, Helvetica, sans-serif">If you set the SWT mode 
  you must also provide a Display object which RChart will use for creating colors 
  and fonts:</font></p>
<blockquote> 
  <p><font face="Courier New, Courier, mono" size="-1">SwtGraphicsProvider.setDefaultDisplay(display);</font></p>
</blockquote>
<p><font face="Arial, Helvetica, sans-serif" size="-1">If you do not set the display, 
  RChart will create a new display. Since an application can only have 1 display 
  this might trigger an error.</font></p>
<p><font face="Arial, Helvetica, sans-serif" size="-1">This design also means 
  you should not use AWT or SWT font and color objects but RChart's abstract object 
  instead. There are 3 type of graphic object you are interested in if you are 
  going to create the chart using the Java API:</font></p>
<ul>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">Font: you create a font 
    in java code using the following call:<br>
    <br>
    <font face="Courier New, Courier, mono">GraphicsProvider.getFont("Arial",ChartFont.PLAIN,10); 
    </font><br>
    <br>
    The parameters of the getFont() method are: font name, style (PLAIN, BOLD 
    or ITALIC) and size. </font><font face="Arial, Helvetica, sans-serif" size="-1"><br>
    <br>
    </font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">Color: you create a 
    color in Java code using the following call:<br>
    <br>
    </font><font face="Courier New, Courier, mono" size="-1">GraphicsProvider.getColor(ChartColor.BLACK);<br>
    <br>
    <font face="Arial, Helvetica, sans-serif">The parameters of the getColor() 
    method can be a color name (for example ChartColor.WHITE) or the RGB values 
    of the color. For example:</font> <br>
    <br>
    GraphicsProvider.getColor(&lt;red&gt;,&lt;green&gt;,&lt;blue&gt;); <br>
    <br>
    <font face="Arial, Helvetica, sans-serif">where the RGB values are integers 
    between 0 and 255.<br>
    <br>
    </font></font></li>
  <li><font face="Arial, Helvetica, sans-serif" size="-1">Image: You must create 
    an image to be used in the chart (for example as background):</font><br>
    <br>
    <font face="Courier New, Courier, mono" size="-1">GraphicsProvider.getImageFromFile(&quot;myimage.gif&quot;); 
    </font> </li>
</ul>
<p>&nbsp;</p>
<hr>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>
